#!/usr/bin/env python3.0

import sys

print(sys.path)
sys.path.append("../")
sys.path.append("./")

import daapclient

if len(sys.argv)>1 and sys.argv[1]=='-debug':
	del sys.argv[1]
	import pdb
	pdb.set_trace()

def checkItemList(items):
	print("there are {0:d} items".format(len(items)))
	for item in items:
		#assert len(item)==4, str(item)
		if len(item)!=4:
			print("title: "+item[daapclient.ITEMNAME])
			print("id:    "+item[daapclient.ITEMID])
			print("album: "+item[daapclient.SONGALBUM])
			print("artist:"+item[daapclient.SONGARTIST])


def main():
	daap = daapclient.Daap(sys.argv[1])
	itemList = daap.getItemList_0((daapclient.ITEMID,daapclient.ITEMNAME,daapclient.SONGARTIST,daapclient.SONGALBUM))
	#itemList = daap.getItemList()

	#print(len(itemList[0]))
	checkItemList(itemList)

	#with open(sys.argv[1], "rb") as fo:
		#list = daap.getItemList_fromBuff_0(fo)
		#daap._Daap__printTree(list)

main()


